Progress Report
Completed Tasks
Add module docstrings to all files
- Created
api/__init__.pywith docstring - Confirmed
network/__init__.pyhas docstring - Added docstring to
storage/models.py
- Created
-
Rename
ConnectionErrortoVPNConnectionError- Updated in
exceptions.py - Updated in
storage/models.py - Updated in
core/client.py - Updated in
__init__.py
- Updated in
-
Make boolean parameters keyword-only
- Updated in
core/client.py - Updated in
core/api.py - Updated in
network/vpn.py
- Updated in
-
Move main blocks to test files
- Created
tests/test_v1_recommendations.py - Created
tests/test_v1_groups.py - Created
tests/test_v1_technologies.py - Created
tests/test_api.py - Created
tests/test_v2_servers.py - Removed main blocks from corresponding files
- Removed from
v1_recommendations.py - Removed from
v1_groups.py - Removed from
v1_technologies.py - Removed from
api.py - Removed from
v2_servers.py
- Removed from
- Created
src/nyord_vpn/api/)src/nyord_vpn/api/api.py- Remove shebang and any commented-out code at the top
- Implement
NordVPNAPIclass with proper docstrings and type hints - Add
find_best_servermethod with v2 API support and v1 fallback - Update v1 methods with deprecation notices and keyword-only arguments
-
src/nyord_vpn/api/v1_*.pyfiles- Add deprecation notices to docstrings
- Fix boolean positional arguments
- Add proper docstrings to classes and methods
- Update error handling to use specific exceptions from exceptions.py
-
src/nyord_vpn/api/v2_servers.py- Fix linting issues, particularly ambiguous variable names (E741)
- Add proper docstrings to methods
- Add comprehensive type hints where missing
Core Module (src/nyord_vpn/core/)
src/nyord_vpn/core/api.pyandsrc/nyord_vpn/core/base.py- Add deprecation warnings
- Fix boolean positional arguments and other linting issues
Remaining Tasks
Core Module (src/nyord_vpn/core/)
src/nyord_vpn/core/client.py
Action: Refactor significantly to use the new API.
- Update to use the new
NordVPNAPIclass - Improve error handling and user feedback
- Break down complex methods into smaller helper functions
- Fix boolean arguments and other linting issues
Network Module (src/nyord_vpn/network/)
src/nyord_vpn/network/server.py
Action: Refactor to use new API.
- Add type hints for functions and variables
- Replace random.randrange and random.choice with secrets module
- Address security issues in subprocess calls by validating input
- Reduce complexity by extracting helper functions
src/nyord_vpn/network/vpn.py
Action: Refactor for better maintainability.
- Make boolean arguments keyword-only
- Add type hints
- Add retry logic for connection attempts
- Break down complex methods
- Replace random.uniform with secrets.SystemRandom().uniform
- Improve error handling
src/nyord_vpn/network/vpn_commands.py
Action: Refactor for better usability.
- Create
OpenVPNConfigdataclass - Implement
get_openvpn_commandfunction with proper validation
Utils Module (src/nyord_vpn/utils/)
src/nyord_vpn/utils/templates.py
Action: Simplify with tenacity.
- Implement retry logic with tenacity
- Break down complex functions into smaller ones
- Improve docstrings and type hints
Main Module Files
src/nyord_vpn/__main__.py
Action: Update to use new API.
- Update CLI class to use the updated Client
- Improve error handling and user feedback
Tests
Action: Update to reflect code changes.
- Update imports to use
VPNConnectionErrorinstead ofConnectionError - Update test fixtures to match model requirements
- Fix validation errors in tests
- Update integration tests to use correct import paths
Documentation
Action: Update documentation.
- Update README.md with installation and usage instructions
- Add API documentation
- Add usage examples